using System;
using System.Linq;
using System.Reflection;
using System.Web.Mvc;
using WB.Mvc.Forms;

namespace WB.Mvc.Demo.Controllers
{

	//public class ModelFilterAttribute : ActionFilterAttribute
	//{
	//    public override void OnActionExecuting(ActionExecutingContext filterContext)
	//    {
	//        ParameterInfo formParameter =
	//            filterContext..GetParameters()
	//                .SingleOrDefault(x => typeof(FormBase).IsAssignableFrom(x.ParameterType));
	//        Type formType = formParameter.ParameterType;

	//        FormBase form;

	//        if (filterContext.HttpContext.Request.HttpMethod == "POST")
	//            form = FormFactory.Current.Resolve(formType, filterContext.HttpContext.Request.Form);
	//        else
	//            form = FormFactory.Current.Resolve(formType);

	//        filterContext.ActionParameters[formParameter.Name] = form;
	//    }
	//}


}